package NovelBar.service;

import NovelBar.entity.Evaluate;
import NovelBar.mapper.EvaluateMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Service
public class EvaluateService {
    @Autowired
    EvaluateMapper evaluateMapper;

    public int insertEvaluate(Evaluate record){
        Date date = new Date();
        SimpleDateFormat matter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        record.setDate(matter.format(date).toString());
        return evaluateMapper.insertEvaluate(record);
    }

    public List<Evaluate> selectByBookId(Integer bookId){
        return evaluateMapper.selectByBookId(bookId);
    }
}
